<?php

namespace app\common\model;

/**
 * 我们的产品服务  合作商分类  项目分类
 * Class StoreCate
 * @package app\common\model
 */
class StoreCate extends Base
{
    protected $name = 'web_service';
    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = true;
    // 定义时间戳字段名
    protected $dateFormat  = 'Y-m-d H:i:s';
    protected $createTime = 'create_time';
    // 追加属性
    protected $append = [
    ];
    const STOP = 0;//禁用
    const NORMAL = 1;//正常

    protected static function init()
    {
        self::beforeDelete(function($row){
            PartnerCase::where('cate_id',$row['id'])->delete();
            /*model("Product")->where('cate_id',$row['id'])->delete();*/
        });
    }

    public function limitList($limit = ""){
        $this->order('weigh desc');
        if($limit){
            $this->limit(0,$limit);
        }
        return $this->select();
    }
}